import 'element-plus/dist/index.css'
import '@/assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 引入 Mock（仅在开发环境中引入）
if (import.meta.env.MODE === 'development') {
    await import('./mock')
}

import { permission } from './utils/permission'

const app = createApp(App)

app.use(createPinia())
app.use(router)

// 全局注册 所有图标集
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}

// 全局注册自定义指令 - 权限功能
app.directive('permission', permission);

app.mount('#app')